package com.icebergteam.warfacewidget.rank.data;

import com.icebergteam.warfacewidget.core.ListViewItem;
import android.os.Parcel;
import android.os.Parcelable;

public class TopUsersItem extends ListViewItem  {

	static public final String className = TopUsersItem.class.getCanonicalName();
	private int rank;
	private String name;
	private int userRating;
	private int monthRating;
	private int topClansRating;
	private int id;
	
	/*1- Alpha, 2-Bravo*/
	private int server;
	
	public TopUsersItem() {
		super();
		setRank(-1);
		setName("user");
		setUserRating(-1);
		setMonthRating(-1);
		setClansRating(-1);
		setServer(-1);
		setId(-1);
	}

	public TopUsersItem(Parcel in) {
		super(in);
	
	}
	
	@Override
	public void writeToParcel(Parcel out, int flags) {
		out.writeInt(this.rank);
		out.writeString(this.name);
		out.writeInt(this.userRating);
		out.writeInt(this.monthRating);
		out.writeInt(this.topClansRating);
		out.writeInt(this.server);
		out.writeInt(this.id);
	}
	@Override
	public void readFromParcel(Parcel in) {
		setRank(in.readInt());
		setName(in.readString());
		setUserRating(in.readInt());
		setMonthRating(in.readInt());
		setClansRating(in.readInt());
		setServer(in.readInt());
		setId(in.readInt());
	}

	public static final Parcelable.Creator<TopUsersItem> CREATOR = new Parcelable.Creator<TopUsersItem>() {
		public TopUsersItem createFromParcel(Parcel in) {
			return new TopUsersItem(in);
		}

		public TopUsersItem[] newArray(int size) {
			return new TopUsersItem[size];
		}
	};
	
	@Override
	public String toString() {
		return String.format("%s = [%s; %s; %s; %s; %s; %s; %s]", className, getId(), getRank(), getName(), getUserRating(), getMonthRating(), getClansRating(), getServer());
	}

	
	public int getRank() {
		return rank;
	}

	public void setRank(int rank) {
		this.rank = rank;
	}

	public int getUserRating() {
		return userRating;
	}

		public void setUserRating(int ratingUser) {
		this.userRating = ratingUser;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getMonthRating() {
		return monthRating;
	}

	public void setMonthRating(int monthRating) {
		this.monthRating = monthRating;
	}

	public String getPreviewStr(){
		return String.format("%s_%s", TopUsersItem.class.getName().replace(TopUsersItem.class.getPackage().getName() , ""), getName());
	}

	public int getClansRating() {
		return topClansRating;
	}

	public void setClansRating(int clansName) {
		this.topClansRating = clansName;
	}

	public int getServer() {
		return server;
	}

	public void setServer(int server) {
		this.server = server;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}
}